package com.managertrade.dao.mysql.entity;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.time.LocalDateTime;

@Data
@Entity
@Table(name = "distributed_lock")
public class DistributedLock {

    @Id
    @Column(name = "lock_name", nullable = false, length = 100)
    private String lockName;  // 锁名称（主键）

    @Column(name = "locked_by", nullable = false, length = 100)
    private String lockedBy;  // 当前持有锁的实例标识

    @Column(name = "locked_at", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
    private LocalDateTime lockedAt = LocalDateTime.now(); // 加锁时间
}